# -*-coding: Utf-8 -*-
# @File : app .py
# author: Chimengmeng
# blog_url : https://www.cnblogs.com/dream-ze/
# Time：2023/10/7
import uvicorn
from starlette.templating import Jinja2Templates
from database.data_base import engine

from fastapi import FastAPI, APIRouter
from views.api import views_api
from FastapiTest.models.models_base import Base



from fastapi import FastAPI, APIRouter

app = FastAPI(
    title='布隆过滤器测试',
    description='布隆过滤器测试',
    version='1.0.0',
)


@app.get('/')
async def home():
    return {"code": 200}


# 创建前端页面配置
templates = Jinja2Templates(directory='.templates')

# 初始化数据库引擎对象
Base.metadata.create_all(bind=engine)

app.include_router(views_api, prefix="", tags=["路由"])


def run():
    # run:app : 启动文件:app名字
    # host ：IP
    # port : 端口
    # reload ： 自动重启
    # debug ：debug 模式
    # worker ： 开启的进程数
    uvicorn.run('app:app', host='127.0.0.1', port=9999, reload=True, workers=1)


if __name__ == '__main__':
    run()
